#include <bits/stdc++.h>
#ifndef DEBUG
#define debug
#endif
using namespace std;
using i64 = int64_t;

const int mod = 1000000007;
int main() {
  cin.tie(0)->sync_with_stdio(0);
  string str;
  cin >> str;
  int n = str.size();
  str = ' ' + str;

  vector<int> rightIndex(n + 1, -1);
  stack<int> st;
  for (int i = 1; i <= n; i ++) {
    if (str[i] == '(') {
      st.push(i);
    } else {
      rightIndex[st.top()] = i;
      st.pop();
    }
  }

  vector<vector<array<i64, 18>>> dp(n + 1, vector<array<i64, 18>>(n + 1));
  for (int l = n - 1; l >= 1; l --) {
    if (str[l] == '(' && str[l + 1] == ')') {
      // (0, 1) (0, 2) (1, 0) (2, 0)
      // 1 2 3 6
      for (auto x : {1, 2, 3, 6}) {
        dp[l][l + 1][x] = dp[l][l + 1][x + 9] = 1;
      }
    }
    for (int r = l + 3; r <= n; r += 2) {
      if (rightIndex[l] == r) {
        for (int i = 0; i < 9; i ++) {
          int cl = i / 3, cr = i % 3;
          if (cl && cr) continue;
          if (cl == cr && cl == 0) continue;
          for (int j = 0; j < 9; j ++) {
            int ccl = j / 3, ccr = j % 3;
            if (cl == ccl && cl) continue;
            if (cr == ccr && cr) continue;
            dp[l][r][i] = (dp[l][r][i] + dp[l + 1][r - 1][j]) % mod;
            dp[l][r][i+9] = (dp[l][r][i+9] + dp[l + 1][r - 1][j]) % mod;
          }
        }
      } else {
        int k = rightIndex[l] + 1;
        if (k == 0 || k > r) continue;
        for (int i = 0; i < 9; i ++) {
          int cl = i / 3, cr = i % 3;
          for (int j = 0; j < 9; j ++) {
            int ccl = j / 3, ccr = j % 3;
            if (cr == ccl && cr) continue;
            int nst = cl * 3 + ccr;
            dp[l][r][nst] = (dp[l][r][nst] + dp[l][k - 1][i + 9] * dp[k][r][j]) % mod;
          }
        }
      }
    }
  }
  cout << accumulate(dp[1][n].begin(), dp[1][n].begin() + 9, 0ll) % mod << endl;
}